package com.ncu.mixproject;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

public class UrlActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_url);

        Intent intent = this.getIntent();
        String title =  intent.getStringExtra("title");
        this.setTitle(title);

//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_DENIED) {
//            if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.M){
//                requestPermissions(
//                        new String[]{Manifest.permission.SEND_SMS},1
//                );
//            }
//        }
        ImageView btnBrowseUrl = (ImageView)findViewById(R.id.btn_browse_dial);
        btnBrowseUrl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText editText = (EditText)findViewById(R.id.edit_url);
                String Number = editText.getText().toString();

                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Number));
                startActivity(intent);
            }
        });
    }
}
